using System;
using System.Text;
using System.Collections;
using Portal.Core.Web.UI;

namespace Portal.Data.Webparts
{
    public class DragDropProvider
    {
        #region data
        private readonly Hashtable _zones = new Hashtable();
        #endregion

        #region method
        public void SetLayout(WebLayout wlayout)
        {
            foreach (string zone in wlayout.allZones())
            {
                _zones.Add(zone, new ArrayList());
            }
        }

        public void Render(System.Web.UI.HtmlTextWriter writer)
        {
            var sb = new StringBuilder();
            sb.Append("<script>\n");

            //drop Zones
            foreach (string zone in _zones.Keys)
            {
                sb.Append(String.Format("createDropZone('{0}');\n", zone));
            }
            sb.Append("</script>");

            writer.Write(sb.ToString());
        }
        #endregion
    }
}
